

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Edit Pedido</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir:'')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list">Pedido List</g:link></span>
            <span class="menuButton"><g:link class="create" action="create">New Pedido</g:link></span>
        </div>
        <div class="body">
            <h1>Edit Pedido</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${pedidoInstance}">
            <div class="errors">
                <g:renderErrors bean="${pedidoInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <input type="hidden" name="id" value="${pedidoInstance?.id}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dataDeLiberacao">Data De Liberacao:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:pedidoInstance,field:'dataDeLiberacao','errors')}">
                                    <g:datePicker name="dataDeLiberacao" value="${pedidoInstance?.dataDeLiberacao}" ></g:datePicker>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dataDoPedido">Data Do Pedido:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:pedidoInstance,field:'dataDoPedido','errors')}">
                                    <g:datePicker name="dataDoPedido" value="${pedidoInstance?.dataDoPedido}" ></g:datePicker>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="itensPedidos">Itens Pedidos:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:pedidoInstance,field:'itensPedidos','errors')}">
                                    
<ul>
<g:each var="i" in="${pedidoInstance?.itensPedidos?}">
    <li><g:link controller="itensPedidos" action="show" id="${i.id}">${i?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="itensPedidos" params="['pedido.id':pedidoInstance?.id]" action="create">Add ItensPedidos</g:link>

                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="situacao">Situacao:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:pedidoInstance,field:'situacao','errors')}">
                                    <input type="text" id="situacao" name="situacao" value="${fieldValue(bean:pedidoInstance,field:'situacao')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="unidadeAcademica">Unidade Academica:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:pedidoInstance,field:'unidadeAcademica','errors')}">
                                    <g:select optionKey="id" from="${UnidadeAcademica.list()}" name="unidadeAcademica.id" value="${pedidoInstance?.unidadeAcademica?.id}" ></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="valor">Valor:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:pedidoInstance,field:'valor','errors')}">
                                    <input type="text" id="valor" name="valor" value="${fieldValue(bean:pedidoInstance,field:'valor')}" />
                                </td>
                            </tr> 
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" value="Update" /></span>
                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
